<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no">
    <title>完善资料</title>
    <link rel="stylesheet" href="css/base.css">
    <link rel="stylesheet" href="css/index.css">

    <link href="css2/mobiscroll.scroller.css" rel="stylesheet" />
    <link href="css2/mobiscroll.scroller.android-ics.css" rel="stylesheet" />
    <style>
        html,
        body {
            height: 100%;
            -webkit-user-select: none;
            user-select: none;
            background-color:#FAEBD7;
        }
        
        .choose_phar ul li>span .pharmacy_active {
            transform: scale(1, 1);
            -webkit-transform: scale(1, 1);
        }
        
        .backg3 {
            width: 100%;
            height: 100%;
            background: #000;
            opacity: 0;
            /* opacity: 0.5; */
            position: fixed;
            z-index: -2000;
            /* z-index: 2000; */
            overflow: hidden;
            top: 0;
            bottom: 0;
            left: 0;
            right: 0;
        }
        
        .spinner {
            margin: 0 auto;
            width: 1.5rem;
            height: 1.5rem;
            position: relative;
            z-index: 30000;
            top: 3rem;
            display: none;
        }
        
        .container1>div,
        .container2>div,
        .container3>div {
            width: .4rem;
            height: .4rem;
            background-color: #f75e0c;
            border-radius: 100%;
            position: absolute;
            -webkit-animation: bouncedelay 1.2s infinite ease-in-out;
            animation: bouncedelay 1.2s infinite ease-in-out;
            -webkit-animation-fill-mode: both;
            animation-fill-mode: both;
        }
        
        .spinner .spinner-container {
            position: absolute;
            width: 100%;
            height: 100%;
        }
        
        .container2 {
            -webkit-transform: rotateZ(45deg);
            transform: rotateZ(45deg);
        }
        
        .container3 {
            -webkit-transform: rotateZ(90deg);
            transform: rotateZ(90deg);
        }
        
        .circle1 {
            top: 0;
            left: 0;
        }
        
        .circle2 {
            top: 0;
            right: 0;
        }
        
        .circle3 {
            right: 0;
            bottom: 0;
        }
        
        .circle4 {
            left: 0;
            bottom: 0;
        }
        
        .container2 .circle1 {
            -webkit-animation-delay: -1.1s;
            animation-delay: -1.1s;
        }
        
        .container3 .circle1 {
            -webkit-animation-delay: -1.0s;
            animation-delay: -1.0s;
        }
        
        .container1 .circle2 {
            -webkit-animation-delay: -0.9s;
            animation-delay: -0.9s;
        }
        
        .container2 .circle2 {
            -webkit-animation-delay: -0.8s;
            animation-delay: -0.8s;
        }
        
        .container3 .circle2 {
            -webkit-animation-delay: -0.7s;
            animation-delay: -0.7s;
        }
        
        .container1 .circle3 {
            -webkit-animation-delay: -0.6s;
            animation-delay: -0.6s;
        }
        
        .container2 .circle3 {
            -webkit-animation-delay: -0.5s;
            animation-delay: -0.5s;
        }
        
        .container3 .circle3 {
            -webkit-animation-delay: -0.4s;
            animation-delay: -0.4s;
        }
        
        .container1 .circle4 {
            -webkit-animation-delay: -0.3s;
            animation-delay: -0.3s;
        }
        
        .container2 .circle4 {
            -webkit-animation-delay: -0.2s;
            animation-delay: -0.2s;
        }
        
        .container3 .circle4 {
            -webkit-animation-delay: -0.1s;
            animation-delay: -0.1s;
        }
        
        @-webkit-keyframes bouncedelay {
            0%,
            80%,
            100% {
                -webkit-transform: scale(0.0)
            }
            40% {
                -webkit-transform: scale(1.0)
            }
        }
        
        @keyframes bouncedelay {
            0%,
            80%,
            100% {
                transform: scale(0.0);
                -webkit-transform: scale(0.0);
            }
            40% {
                transform: scale(1.0);
                -webkit-transform: scale(1.0);
            }
        }
        /* /
        
        2018=4=12
        
        */
        
        .DefaultPharmacy>span {
            display: block;
            width: .34rem;
            height: 100%;
            background: url(images/more.png) no-repeat center center;
            background-size: .14rem .24rem;
            margin-right: .2rem;
            transition: rotate 5s;
            -webkit-transition: rotate 5s;
        }
        
        .DefaultPharmacy div {
            display: flex;
            display: -webkit-flex;
            align-items: center;
            -webkit-align-items: center;
        }
        
        .DefaultPharmacy {
            justify-content: space-between;
            -webkit-justify-content: space-between;
            border-bottom: 0;
        }
    </style>
</head>

<body>
    <div class="wrap" style="background-color:#fff0dc;">
        <div class="main">
            <!-- 贴数及用药方法 -->
            <div class="method height_80 ">
                <span class="img_icon1 img_public"> </span>
                <span class="htyy_text">贴数及用药方法</span>
            </div>
            <!-- 选择用法 -->
            <div class="use_method">
                <div class="choose_method">
                    <span>用法:</span>
                    <div>
                        <span class="click_in method_active">内服</span>
                        <span class="click_in">外用</span>
                    </div>
                </div>
                <div class="lists_wrap">
                    <div class="choose_lists">
                        <div class="method_in">
                            <span class="drug_num">贴数</span>
                            <div class="num_lists">
                                <div class="num_tie">
                                    <div id="ch_n2">
                                        <span class="num_show">5</span>
                                        <span class="num_icon"></span>
                                    </div>

                                </div>
                                <span>贴,</span>
                                <div class="num_tie">
                                    <div id="ch_n3">
                                        <span class="num_show">1</span>
                                        <span class="num_icon"></span>
                                    </div>


                                </div>
                                <span>日</span>
                                <div class="num_tie">
                                    <div id="ch_n4">
                                        <span class="num_show">1</span>
                                        <span class="num_icon"></span>
                                    </div>

                                </div>
                                <span>贴，分</span>
                                <div class="num_tie">
                                    <div id="ch_n5">
                                        <span class="num_show">2</span>
                                        <span class="num_icon"></span>
                                    </div>

                                </div>
                                <span>次服用</span>
                            </div>
                            <span class="method_in_s">说明：免煎颗粒剂默认分成2小袋包装 </span>
                        </div>
                        <div class="method_out" style="background-color:#FAEBD7;">
                            <textarea rows="3" cols="20" style="background-color:#FAEBD7;" placeholder="请输入具体用法"></textarea>
                        </div>
                    </div>
                </div>

            </div>
            <!-- 事件 -->
            <div class="use_time">
                <span>时间:</span>
                <div class="choose_time">
                    <span class="eat_time">饭后一小时</span>
                    <span></span>
                </div>
            </div>
            <!-- 分割线 -->
            <div class="line"></div>
            <!-- 忌口与禁忌 -->
            <div class="method height_80 ">
                <span class="img_icon2 img_public"> </span>
                <span class="htyy_text">忌口与禁忌</span>
            </div>
            <div class="prohibit">
                <ul class="height_hidden clearfloat">
                    <li class="prohibit_no fry_active wu ">无</li>
                    <li class="prohibit_yes xl ">忌辛辣</li>
                    <li class="prohibit_yes yn ">忌油腻</li>
                    <li class="prohibit_yes sl ">忌生冷</li>
                    <li class="prohibit_yes yj ">忌烟酒</li>
                    <li class="prohibit_yes fw ">忌发物</li>
                    <li class="prohibit_yes hy">忌荤腥</li>
                    <li class="prohibit_yes ss">忌酸涩</li>
                    <li class="prohibit_yes cjx">忌刺激性食物</li>
                    <li class="prohibit_yes mx">忌敏性食物</li>
                    <li class="prohibit_yes nxh">忌难消化食物</li>
                    <li class="prohibit_yes byj">备孕禁服</li>
                    <li class="prohibit_yes hyj">怀孕禁服</li>
                    <li class="prohibit_yes jq">经期停服</li>
                    <li class="prohibit_yes gm">感冒停服</li>
                    <li class="prohibit_yes hxy">忌与西药同服</li>
                </ul>
                <div class="pro_more">
                    <span id="txt">查看更多</span>
                    <span id="ico"></span>
                </div>
            </div>
            <!-- 填写其他医嘱 -->
            <div class="other_tell" style="background-color:#FAEBD7;">
                <textarea rows="3" cols="20" style="background-color:#FAEBD7;" placeholder="填写其他医嘱"></textarea>
            </div>
            <div class="line"></div>
            <!-- 辩证思路 -->
<!--            <div class="height_80 method thinking">-->
<!--                <div>-->
<!--                    <span class="icon_3"></span>-->
<!--                    <span>辩证思路（患者不可见）</span>-->
<!--                </div>-->
<!--                <span></span>-->
<!--            </div>-->
<!--            <div class="other_tell input_think input_think_active">-->
<!--                <textarea rows="3" cols="20" placeholder="填输入辩证思路"></textarea>-->
<!--            </div>-->
<!--            <div class="line"></div>-->
            <!-- ====================内服=============================== -->
            <!-- ===============================TODO=============================================== -->
<!--            <div class="height_80 method  DefaultPharmacy ">-->
<!--                <div>-->
<!--                    <span class="icon_3"></span>-->
<!--                    <span>中心药房</span>-->
<!--                </div>-->
<!--                <span></span>-->
<!--            </div>-->
<!--            <div class="in input_think_active">-->
<!--                &lt;!&ndash; 请选择供应商 &ndash;&gt;-->
<!--                <div class="positions">-->
<!--                    <span>所在区域:</span>-->
<!--                    &lt;!&ndash; <span class="ssqu" id="sel_city">福建省 福州市</span> &ndash;&gt;-->
<!--                    <input id="area" placeholder="请选择所在地区" areaid="10072 10131 11159" readonly="" class="">-->
<!--                    <span class="choose_city"></span>-->
<!--                </div>-->
<!--                &lt;!&ndash; 选择代煎代送？ &ndash;&gt;-->
<!--                <div class="choose_fry">-->
<!--                    &lt;!&ndash; <span class="fry_active">代煎代送</span>-->
<!--                    <span>自煎自取</span>-->
<!--                    <span>自煎代送</span>-->
<!--                    <span>自煎代送</span> &ndash;&gt;-->
<!--                </div>-->
<!--                &lt;!&ndash; 选择药房 &ndash;&gt;-->
<!--                <div class="choose_phar">-->

<!--                </div>-->
<!--            </div>-->

            <!-- ==========================内服结束============================= -->


            <!-- 分割线 -->
<!--            <div class="line"> </div>-->

            <!-- 费用 -->
<!--            <div class="method height_80 ">-->
<!--                <span class="img_icon4 img_public"> </span>-->
<!--                <span class="htyy_text">费用</span>-->
<!--            </div>-->
            <!-- 费用列表 -->
<!--            <div class="cost_lists">-->
<!--                <ul>-->
<!--                    <li>-->
<!--                        <span class="color1">咨询费用</span>-->
<!--                        <span class="color2 consultation_price">￥0.00</span>-->
<!--                    </li>-->
<!--                    <li>-->
<!--                        <span class="color1">商品费用</span>-->
<!--                        <span class="color2 product_price">￥0.00</span>-->
<!--                    </li>-->
<!--                    <li>-->
<!--                        <span class="color1">代煎费用</span>-->
<!--                        <span class="color2 foundry">￥10.00</span>-->
<!--                    </li>-->
<!--                    <li>-->
<!--                        <span class="color1">运费 </span>-->
<!--                        <span class="color2 freight">￥10.00</span>-->
<!--                    </li>-->


<!--                </ul>-->
<!--                <div class="totals">-->
<!--                    <span>合计</span>-->
<!--                    <span>￥10.00</span>-->
<!--                </div>-->
<!--            </div>-->

        </div>
        <div class="footer footer_pos">提交</div>
        <!-- 一些弹出层 -->
        <div class="popups" style="background-color:#FAEBD7;">
            <div class="backg2"></div>
            <!-- 饭前？饭后？的时间 -->
            <div class="choose_times" >
                <ul style="background-color:#FAEBD7;">
                    <li class="time1">饭前一小时</li>
                    <li class="time1">饭后一小时</li>
                    <li class="time1">空腹服</li>
                    <li class="time1">晨起服</li>
                    <li class="custom">自定义</li>
                </ul>
                <div style="background-color:#FAEBD7;">取消</div>
            </div>
            <!-- 自定义服用时间 -->
            <div class="time_custom">
                <div class="custom_input">
                    <input type="text" placeholder="请输入自定义">
                </div>
                <div class="yorn">
                    <span class="yorn_n">取消</span>
                    <span class="yorn_y">确定</span>
                </div>
            </div>
            <!-- 确认提交 -->
            <!--  /* ////////////////////////////////////////2018.1.15 */ -->
            <div class="popup_sub">
                <div class="sub_ti">请您确定是否提交</div>
                <div class="sub_yseorno">
                    <span>取消</span>
                    <span class="sub_yes2" onclick="upOk()">确认</span>
                </div>
            </div>
            <!-- loading -->
            <div class="backg3"></div>
            <div class="spinner">
                <div class="spinner-container container1">
                    <div class="circle1"></div>
                    <div class="circle2"></div>
                    <div class="circle3"></div>
                    <div class="circle4"></div>
                </div>
                <div class="spinner-container container2">
                    <div class="circle1"></div>
                    <div class="circle2"></div>
                    <div class="circle3"></div>
                    <div class="circle4"></div>
                </div>
                <div class="spinner-container container3">
                    <div class="circle1"></div>
                    <div class="circle2"></div>
                    <div class="circle3"></div>
                    <div class="circle4"></div>
                </div>
            </div>
            <!-- 贴数  次数   的选择 -->
            <!-- <div class="choose_nums">
                <div class="nums_title">
                    <span>取消</span>
                    <span>贴数</span>
                    <span>确定</span>
                </div>
            </div> -->

        </div>
    </div>
    <script src="js/jquery-1.8.3.js"></script>
    <script src="js/index.js"></script>
    <script src="layer/layer.js"></script>
    <!-- <script src="js/city.js"></script> -->
    <script src="js/picker.min.js"></script>
    <script src="js/pockerdata.js"></script>

    <script src="js2/zepto.js"></script>
    <script src="js2/mobiscroll.zepto.js" type="text/javascript"></script>
    <script src="js2/mobiscroll.core.js" type="text/javascript"></script>
    <script src="js2/mobiscroll.scroller.js" type="text/javascript"></script>
<!--    <script src="js2/mobiscroll.area.js"></script>-->
    <script src="js2/mobiscroll.scroller.android-ics.js"></script>
    <script src="js/i18n/mobiscroll.i18n.zh.js"></script>

    <script>
        var test = "";
        var tags = 0;
        var index = {
            config: {
                valo: $("#area").attr("areaid"),
                val: null,
                str: '',
                lis: '',
                listhree: '',
                type: 1,
                give_type: 2,
                jidata: [
                    "无"
                ],
                jidatas: [
                    // "无"
                    "忌辛辣", "忌油腻", "忌生冷", "忌烟酒", "忌发物", "忌荤腥", "忌酸涩", "忌刺激性食物",
                    "忌敏性食物", "忌难消化食物", "备孕禁服", "怀孕禁服", "经期停服", "感冒停服", "忌与西药同服"
                ],
                freight: 0, //运费
                // foundry: 2, //代煎费
                pharmacy: [
                    [{
                        address: '南后街三坊七巷6号',
                        name: '瑞来春堂(福州三坊七巷店)',
                        e: 0,
                        service: '1',
                        aa: 1,
                        supplier_id: '000000',
                        total: 1196.02

                    }, {
                        address: '中心药房',
                        name: '中心药房',
                        e: 1,
                        aa: 1,
                        service: '1',
                        supplier_id: '000000',
                        total: 11.9
                    }],

                    [{
                        address: '2号药房',
                        name: '哈哈药房',
                        e: 0,
                        aa: 1,
                        service: '1',
                        supplier_id: '000000',
                        total: 152.5
                    }, {
                        address: '2号药房',
                        name: '呵呵药房',
                        e: 1,
                        aa: 1,
                        service: '1',
                        supplier_id: '000000',
                        total: 16.2
                    }, {
                        address: '2号药房',
                        name: '嘿嘿药房',
                        e: 0,
                        aa: 10,
                        service: '1',
                        supplier_id: '000000',
                        total: 196.2
                    }],

                    [{
                        address: '3号药房',
                        name: '很贵的药房',
                        e: 0,
                        aa: 111,
                        service: '1',
                        supplier_id: '000000',
                        total: 1906.2
                    }, {
                        address: '3号药房',
                        name: '不贵的药房',
                        e: 1,
                        aa: 551,
                        service: '1',
                        supplier_id: '000000',
                        total: 1.2
                    }],
                    [{
                        address: '4号药房',
                        name: '很牛的药房',
                        e: 0,
                        aa: 1,
                        service: '1',
                        supplier_id: '000000',
                        total: 96.0
                    }]

                ]

            },
            init: function() {
                var _this = this;
                // var x = _this.config.foundry * 5 * 2;
                // $(".foundry").html("￥" + x.toFixed(2)); //代建费
                // $(".freight").html("￥" + _this.config.freight.toFixed(2)); //运费
                if (index.config.type == 2) {
                    index.config.str += " <span class='one'>代煎代送</span> " +
                        "<span class='two'>自煎代送</span> "
                } else if (index.config.type == 1) {
                    index.config.str += " <span class='one'>代煎代送</span> " +
                        "<span class='two'>自煎代送</span> " +
                        "<span class='three'>代煎自取</span> " +
                        " <span class='four'>自取</span> "

                    $(".click_out").remove()
                }
                // console.log(index.config.jkdata[0])

                if (index.config.jidata[0] == "无") {
                    $(".prohibit li:first").addClass("fry_active").siblings().removeClass("fry_active");
                } else {
                    for (var i = 0; i < index.config.jidata.length; i++) {
                        var y = index.config.jidatas.indexOf(index.config.jidata[i]);
                        $(".prohibit li:eq(" + (y + 1) + ")").addClass("fry_active");
                        $(".prohibit li:first").removeClass("fry_active");
                    }
                }

                var strt = "忌辛辣,忌油腻,忌生冷";
                var strArry = new Array();
                strArry = strt.split(",");
                console.log(strArry);






                $(".prohibit .prohibit_yes").each(function(i) {

                    // switch (index.config.jidatas[i]) {
                    //     case '忌辛辣':
                    //         $(".xl").addClass('fry_active');
                    //         $('.wu').removeClass('fry_active');
                    //         break;
                    //     case '忌油腻':
                    //         $(".yn").addClass('fry_active');
                    //         $('.wu').removeClass('fry_active');
                    //         break;
                    //     case '忌生冷':
                    //         $(".sl").addClass('fry_active');
                    //         $('.wu').removeClass('fry_active');
                    //         break;
                    //     case '忌烟酒':
                    //         $(".yj").addClass('fry_active');
                    //         $('.wu').removeClass('fry_active');
                    //         break;
                    //     case '忌发物':
                    //         $(".fw").addClass('fry_active');
                    //         $('.wu').removeClass('fry_active');
                    //         break;
                    //     case '忌荤腥':
                    //         $(".hy").addClass('fry_active');
                    //         $('.wu').removeClass('fry_active');
                    //         break;
                    //     case '忌酸涩':
                    //         $(".ss").addClass('fry_active');
                    //         $('.wu').removeClass('fry_active');
                    //         break;
                    //     case '忌刺激性食物':
                    //         $(".cjx").addClass('fry_active');
                    //         $('.wu').removeClass('fry_active');
                    //         break;
                    //     case '忌敏性食物':
                    //         $(".mx").addClass('fry_active');
                    //         $('.wu').removeClass('fry_active');
                    //         break;
                    //     case '忌难消化食物':
                    //         $(".nxh").addClass('fry_active');
                    //         $('.wu').removeClass('fry_active');
                    //         break;
                    //     case '备孕禁服':
                    //         $(".byj").addClass('fry_active');
                    //         $('.wu').removeClass('fry_active');
                    //         break;
                    //     case '怀孕禁服':
                    //         $(".hyj").addClass('fry_active');
                    //         $('.wu').removeClass('fry_active');
                    //         break;
                    //     case '经期停服':
                    //         $(".jq").addClass('fry_active');
                    //         $('.wu').removeClass('fry_active');
                    //         break;
                    //     case '感冒停服':
                    //         $(".gm").addClass('fry_active');
                    //         $('.wu').removeClass('fry_active');
                    //         break;
                    //     case '忌与西药同服':
                    //         $(".hxy").addClass('fry_active');
                    //         $('.wu').removeClass('fry_active');
                    //         break;
                    //     default:
                    //         $('无').addClass('fry_active').siblings().removeClass('fry_active')
                    // }

                })



                $(".choose_fry").html(index.config.str);
                // $(".choose_fry span").first().addClass("fry_active");
                switch (index.config.give_type) {
                    case 1:
                    case 5:
                        $(".choose_fry .one").addClass("fry_active").siblings().removeClass("fry_active");
                        break;
                    case 2:
                    case 6:
                        $(".choose_fry .two ").addClass("fry_active").siblings().removeClass("fry_active");
                        break;
                    case 3:
                        $(".choose_fry .three ").addClass("fry_active").siblings().removeClass("fry_active");
                        break;
                    case 4:
                        $(".choose_fry .four ").addClass("fry_active").siblings().removeClass("fry_active");
                        break;
                    default:
                        $(".choose_fry span").first().addClass("fry_active");
                }
                index.config.str = ''

                for (var c = 0; c < index.config.pharmacy.length; c++) {

                    if (!index.config.pharmacy[c]) {
                        $(".one").remove();
                        $(".choose_fry span").first().addClass("fry_active");
                    } else {
                        for (var i = 0; i < index.config.pharmacy[c].length; i++) {
                            var x = index.config.pharmacy[c][i].e; ///////////////////////////////
                            // console.log("x的类型" + typeof(x))
                            // console.log("X的值" + x)
                            // console.log(x == 1)
                            var classneme = ''
                            if (x) {
                                classneme = 'pharmacy_active phar_active'
                            } else {
                                classneme = 'phar_active';
                            }
                            index.config.listhree +=
                                " <li  data-aa='" + index.config.pharmacy[c][i].aa + "'>" +
                                " <span>" +
                                " <span class=' " + classneme + "'></span>" +
                                " </span>" +
                                " <div>" +
                                " <div>" +
                                " <span>" + index.config.pharmacy[c][i].name + "</span>" +
                                " <span class='price'>预估：" + index.config.pharmacy[c][i].total + "</span>" +
                                " </div>" +
                                // " <span>" + index.config.pharmacy[c][i].address + "" +
                                " </div>" +
                                " </li>"
                        }
                        index.config.lis += "<ul class='one '>" + index.config.listhree + "</ul>";
                        index.config.listhree = '';
                        $(".choose_phar ").append(index.config.lis);

                        // console.log(x)
                        // if (!x) {
                        //     $(".choose_phar ul li").first().children().children().css({
                        //         "transform": "scale(1, 1)",
                        //         "-webkit-transform": "scale(1, 1)"
                        //     })
                        // }
                        // $(".choose_phar ul li").first().children().children().css({
                        //     "transform": "scale(1, 1)",
                        //     "-webkit-transform": "scale(1, 1)"
                        // })
                        // $(".choose_phar ul li").find(".")
                        index.config.lis = '';
                    }
                }
                $(".choose_phar ul").each(function() {
                    // console.log($(this).children().find(".phar_active").hasClass("pharmacy_active"))
                    var x = $(this).children().find(".phar_active").hasClass("pharmacy_active");
                    if (!x) {
                        $(this).children().find(".phar_active").first().addClass("pharmacy_active")
                    }
                })

                $(".choose_phar ul").first().addClass("li_active u_p_active");
                $(".choose_phar ul").first().children().find(".pharmacy_active").parent().parent().addClass("p_active"); ////////////////////////////////////////////////////////////////////////////
                var x = $(".choose_phar ul").first().children(".p_active").attr("data-aa")
                    // console.log("dddd" + x)
                $(".li_active").show();
                _this.priceChange();


                // console.log(index.config.pharmacy)
                // _this.priceChange()
                //内服
                _this.foundryIs();
                $(".click_out").click(function() {
                    _this.chooseMethod(true);
                    $(this).addClass("method_active").siblings().removeClass("method_active");
                });
                //外用
                $(".click_in").click(function() {
                    _this.chooseMethod(false);
                    $(this).addClass("method_active").siblings().removeClass("method_active");
                });

                // 服用时间的选择
                $(".choose_time").click(function() {
                    _this.backgOpen(true);
                    _this.boxShow('.choose_times', false);

                });
                //自定义服用时间
                $(".choose_times ul .custom").click(function() {
                    $(".time_custom .custom_input input").focus()
                    _this.boxShow('.choose_times', true);
                    _this.boxShow('.time_custom', false);
                });

                // 自定义时间内容的一些判断
                $(".time_custom .custom_input input").keyup(function() {
                    index.config.val = $(this).val();
                    $(this).focus();
                    _this.inputFont.call(this, index.config.val)
                });
                $(".other_tell textarea").keyup(function() {
                    _this.inputFont.call(this, $(this).val())
                })
                $(".method_out textarea").keyup(function() {
                    _this.inputFont.call(this, $(this).val())
                });
                // 自定义时间的确认
                $(".time_custom .yorn .yorn_y").click(function() {
                    if (index.config.val) {
                        $(".eat_time").text(index.config.val);
                        _this.boxShow('.time_custom', true);
                        _this.backgOpen(false);
                        index.config.val = null;
                        $(".time_custom .custom_input input").val('')
                    } else {
                        layer.msg('请输入自定义内容！', {
                            time: 1000
                        });
                        $(".time_custom .custom_input input").focus();
                    }

                });

                $(".time_custom .yorn .yorn_n").click(function() {
                    $(".time_custom .custom_input input").val('')
                    _this.boxShow('.time_custom', true);
                    _this.backgOpen(false);
                    index.config.val = null;
                });

                $(".backg2,.choose_times ul .time1,.choose_times div").click(function() {
                    _this.boxShow('.choose_times', true);
                    _this.boxShow('.time_custom', true); /* ////////////////////////////////////////2018.1.15 */
                    _this.boxShow('.popup_sub', true); /* ////////////////////////////////////////2018.1.15 */
                    _this.backgOpen(false);

                })

                // 服用时间的选择
                $(".choose_times ul .time1").click(function() {
                    var time = $(this).text();
                    $(".eat_time").text(time)
                })

                //忌口与禁忌的选择    如果选择了其他禁忌  就不选无
                $(".prohibit .prohibit_yes").click(function() {
                    if ($(this).hasClass("fry_active")) {
                        $(this).removeClass("fry_active")
                    } else {
                        $(this).addClass("fry_active");
                    }
                    $(".prohibit .prohibit_no").removeClass("fry_active")
                });
                $(".prohibit .prohibit_no").click(function() {
                    if ($(this).hasClass("fry_active")) {
                        $(this).removeClass("fry_active")
                    } else {
                        $(this).addClass("fry_active");
                    }
                    $(".prohibit .prohibit_yes").removeClass("fry_active")
                });


                $(".pro_more").click(function() {
                    //$(this).remove();
                    if(tags==0){
                        tags=1;
                        $(".prohibit ul").removeClass("height_hidden");
                        $("#txt").text("收起")
                        $("#ico").css("transform","rotate(-180deg)")
                    }else {
                        tags=0;
                        $(".prohibit ul").addClass("height_hidden");
                        $("#txt").text("查看更多")
                        $("#ico").css("transform","rotate(0deg)")
                    }
                })

                $(".thinking").toggle(function() {
                    $(".thinking>span").addClass("icon3_active");
                    $(".input_think").removeClass("input_think_active");
                }, function() {
                    $(".thinking>span").removeClass("icon3_active");
                    $(".input_think").addClass("input_think_active")
                })

                //选择药房
                $(".choose_phar").on("click", "li", function() {
                    $(this).addClass("p_active").siblings().removeClass("p_active")
                    $(this).find(".phar_active").addClass("pharmacy_active")
                    $(this).siblings().find(".phar_active").removeClass("pharmacy_active")
                    _this.config.freight = $(this).attr("data-aa")
                    _this.priceChange();
                });
                $('#area').scroller('destroy').scroller({
                    preset: 'area',
                    theme: 'android-ics light',
                    display: 'bottom',
                    valueo: index.config.valo
                });

                // $("#ch_n2 .num_show").DOMNodeInserted(function() {
                //     _this.priceChange();
                // })

                ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                //城市选择之后
                $(".positions input").change(function() {

                    // $.ajax({
                    //     type: "post",
                    //     url: "http://192.168.5.209/doctor_ajax.php?do=recipecity",
                    //     data: {
                    //         "city_id": 1302,
                    //         "drug_type": 1,
                    //         "type": 1,
                    //     },
                    //     dataType: "json",
                    //     success: function(data) {
                    //         console.log(data)
                    //     },
                    //     error: function(err) {
                    //         layer.msg('连接服务器失败', {
                    //             time: 1000
                    //         });
                    //     }
                    // });


                    $(".choose_fry").html('');
                    $(".choose_phar").html('');
                    if (index.config.type == 2) {
                        index.config.str += " <span class='one'>代煎代送</span> " +
                            "<span class='two'>自煎代送</span> "
                    } else if (index.config.type == 1) {
                        index.config.str += " <span class='one'>代煎代送</span> " +
                            "<span class='two'>自煎代送</span> " +
                            "<span class='three'>代煎自取</span> " +
                            " <span class='four'>自取</span> "
                        $(".click_out").remove()
                    }


                    $(".choose_fry").html(index.config.str);
                    $(".choose_fry span").first().addClass("fry_active");
                    index.config.str = ''

                    for (var c = 0; c < index.config.pharmacy.length; c++) {
                        if (!index.config.pharmacy[c]) {
                            $(".one").remove();
                            $(".choose_fry span").first().addClass("fry_active");
                        } else {
                            for (var i = 0; i < index.config.pharmacy[c].length; i++) {
                                index.config.listhree +=
                                    " <li>" +
                                    " <span>" +
                                    " <span class='phar_active' ></span>" +
                                    " </span>" +
                                    " <div>" +
                                    " <div>" +
                                    " <span>" + index.config.pharmacy[c][i].name + "</span>" +
                                    " <span class='price'>预估：" + index.config.pharmacy[c][i].total + "</span>" +
                                    " </div>" +
                                    // " <span>" + index.config.pharmacy[c][i].address + "" +
                                    " </div>" +
                                    " </li>"
                            }
                            index.config.lis += "<ul class='one '>" + index.config.listhree + "</ul>";
                            index.config.listhree = '';
                            $(".choose_phar ").append(index.config.lis);
                            $(".choose_phar ul li").first().children().children().addClass("pharmacy_active")
                            index.config.lis = '';
                        }
                    }

                    $(".choose_phar ul").first().addClass("li_active u_p_active");
                    $(".choose_phar ul").first().children().first().addClass("p_active");
                    $(".li_active").show();
                    _this.priceChange();
                });
                $(".choose_fry").on("click", "span", function() {

                    $(this).addClass("fry_active").siblings().removeClass("fry_active");
                    var index = $(this).index();
                    $(".choose_phar ul").eq(index).addClass("u_p_active").siblings().removeClass("u_p_active");

                    // console.log($(".choose_phar ul").eq(index).html())

                    $(".choose_phar ul").eq(index).find(".pharmacy_active").parent().parent().addClass("p_active");
                    $(".choose_phar ul").eq(index).siblings().children().removeClass("p_active");
                    $(".choose_phar ul").eq(index).show().siblings().hide();
                    $(".choose_phar ul").eq(index).children().attr("data-aa")
                    _this.config.freight = $(".choose_phar ul").eq(index).children().attr("data-aa")
                    console.log("_this.config.freight" + _this.config.freight)
                    _this.priceChange();
                    _this.foundryIs();
                });
                $(".popup_sub .sub_yseorno span:last").click(function() {
                    //console.log(520)
                    _this.priceChange()
                    _this.loading(true)
                    var type = index.config.type;
                    var use_type, useage, taboo, advise;
                    var arry = [];
                    var arry2 = [];
                    var val = $(".method_active").text();
                    var str = $("#area").attr("areaid");

                    var mul = 5;
                    mul = $("#ch_n2 .num_show").text();
                    var price = $(".choose_phar .u_p_active .p_active>div>div span").last().text();
                    var p = price.substring(3, price.length) * mul; //产品费用
                    var freight2 = $(".freight").text();
                    // console.log(freight2.substring(1, freight2.length))
                    var x = freight2.substring(1, freight2.length); //运费
                    // var min_99 = $(".min_99").text();
                    // var y = min_99.substring(1, min_99.length); //满99的优惠
                    // var z = mul * 2; //代煎费
                    // var c = mul * 2; //促销优惠
                    // console.log(" 商品费用是：" + p, "运费是：" + x, "满减优惠是：" + y, "代煎费用是：" + z, "促销优惠是：" + c)

                    if (val == "内服") {
                        use_type = 0;
                    } else if (val == "外用") {
                        use_type = 1;
                    }
                    $(".num_lists .num_show ").each(function(i) {
                        arry.push($(this).text());
                    })
                    $(".prohibit .fry_active").each(function(i) {
                        arry2.push($(this).text());
                    })
                    useage = arry.join();
                    taboo = arry2.join();
                    advise = $(".other_tell textarea").val();
                    // cityid = str.substring(6, 12);
                    _this.priceChange();
                    test = "当前开方类型是:" + use_type +"贴数：" + useage+ "忌口与禁忌：" + taboo+ "更多医嘱：" + advise;
                    console.log("当前开方类型是:" + use_type, "贴数：" + useage, "忌口与禁忌：" + taboo, "更多医嘱：" + advise)//"城市ID:" + cityid
                });
                $(".popup_sub .sub_yseorno span:first").click(function() { /* ////////////////////////////////////////2018.1.15 */
                    _this.backgOpen(false);
                    _this.boxShow('.popup_sub', true);
                })

                $(".footer_pos").click(function() { /* ////////////////////////////////////////2018.1.15 */
                    _this.backgOpen(true);
                    _this.boxShow('.popup_sub', false);
                });
                ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            },
            chooseMethod: function(bool) {
                var _this = this;
                if (bool) {
                    $(".choose_lists").css({
                        "transform": "translateX(-6.4rem)",
                        "-webkit-transform": "translateX(-6.4rem)"
                    })
                    $(".in").show();

                } else {
                    $(".choose_lists").css({
                        "transform": "translateX(0rem)",
                        "-webkit-transform": "translateX(0rem)"
                    })
                    $(".in").show();
                }
            },
            backgOpen: function(bool) {
                if (bool) {
                    $(".backg2").css({
                        "z-index": "2000",
                        "opacity": ".5"
                    })

                } else {
                    setTimeout(function() {
                        $(".backg2").css({
                            "z-index": "-2000",
                            "opacity": "0"
                        })
                    }, 300)
                }
            },
            boxShow: function(el, bool) {
                if (bool) {
                    $(el).css({
                        "transform": "translateY(8rem)",
                        " -webkit-transition": "translateY(8rem)"
                    })
                } else {
                    $(el).css({
                        "transform": "translateY(0)",
                        " -webkit-transition": "translateY(0)"
                    })
                }
            },
            inputFont: function(bool) {
                if (bool) {
                    $(this).css({
                        "color": "#333",
                        "font-size": ".3rem"
                    })
                } else {
                    $(this).css({
                        "color": "#999",
                        "font-size": ".28rem"
                    })
                }
            },
            priceChange: function() {
                var _this = this;
                var mul = 5; //贴数
                var b = 2; //倍数
                mul = $("#ch_n2 .num_show").text();
                b = $("#ch_n5 .num_show").text();
                var price = $(".choose_phar .u_p_active .p_active>div>div span").last().text();
                var p = price.substring(3, price.length) * mul; //产品费用
                // var freight2 = $(".freight").text();
                // var x = freight2.substring(1, freight2.length); //运费
                // console.log(mul, price, p)
                var consultation_price = 10; //咨询费
                // if (p > 99) {
                //     index.config.freight = -10;
                //     $(".min_99").parent().show();
                // } else {
                //     index.config.freight = 0;
                //     $(".min_99").parent().hide();
                // };

                // if (id == 3 || id == 4) {
                //     $(".freight").parent().hide();
                //     $(".min_99").parent().hide();
                // } else if (id == 1 || id == 2 || id == 5 || di == 6) {
                //     $(".freight").parent().hide();
                //     $(".min_99").parent().hide();
                // }

                var n = _this.config.foundry * mul * b;
                // if (_this.config.type == 2) {
                //     n = 0
                // }

                if (index.config.type == 1) {
                    var val = $(".choose_fry .two").hasClass("fry_active");
                    var val2 = $(".choose_fry .four").hasClass("fry_active");
                    var val3 = $(".choose_fry .three").hasClass("fry_active");
                    if (val || val2) {
                        $(".foundry").parent().hide();
                        n = 0;
                        // $(".promotion").parent().hide();
                    } else {
                        $(".foundry").parent().show();
                        // $(".promotion").parent().show();
                    };
                    if (val2 || val3) {
                        $(".freight").parent().hide();
                        index.config.freight = 0;
                        // $(".min_99").parent().hide();
                    } else {
                        $(".freight").parent().show();
                        // $(".min_99").parent().show();
                    }
                } else if (index.config.type == 2) {
                    $(".foundry").parent().hide();
                    n = 0;
                    // $(".promotion").parent().hide()
                }



                $(".foundry").text("￥" + n.toFixed(2)); //代煎费

                $(".consultation_price").text("￥" + consultation_price.toFixed(2)) //咨询费
                $(".product_price").text("￥" + Number(p).toFixed(2)); //商品费用

                //console.log("总费用为 商品费用" + p + "   咨询费" + consultation_price + " 运费" + _this.config.freight + " 代煎费" + n)
                var zzz = Number(p) + Number(consultation_price) + Number(_this.config.freight) + Number(n);
                $(".cost_lists .totals span").last().text("￥" + zzz.toFixed(2))
            },
            foundryIs: function() {
                if (index.config.type == 1) {
                    var val = $(".choose_fry .two").hasClass("fry_active");
                    var val2 = $(".choose_fry .four").hasClass("fry_active");
                    var val3 = $(".choose_fry .three").hasClass("fry_active");
                    if (val || val2) {
                        $(".foundry").parent().hide();
                        // $(".promotion").parent().hide();
                    } else {
                        $(".foundry").parent().show();
                        // $(".promotion").parent().show();
                    };
                    if (val2 || val3) {
                        $(".freight").parent().hide();
                        // $(".min_99").parent().hide();
                    } else {
                        $(".freight").parent().show();
                        // $(".min_99").parent().show();
                    }
                } else if (index.config.type == 2) {
                    $(".foundry").parent().hide();
                    // $(".promotion").parent().hide()
                }
            },
            loading: function(bool) {
                if (bool) {
                    $(".backg3").css({
                        "opacity": ".5",
                        "z-index": "20000"
                    })
                    $(".spinner").show()
                } else {
                    $(".backg3").css({
                        "opacity": "0",
                        "z-index": "-20000"
                    })
                    $(".spinner").hide()
                }
            }

        }
        index.init();
        if (/Android/gi.test(navigator.userAgent)) {

            window.addEventListener('resize', function() {
                if (document.activeElement.tagName == 'INPUT' || document.activeElement.tagName == 'TEXTAREA') {
                    window.setTimeout(function() {
                        document.activeElement.scrollIntoViewIfNeeded();
                    }, 0);
                }
            })
        }
        function upOk() {

            var type = index.config.type;
            var use_type, useage, taboo, advise;
            var arry = [];
            var arry2 = [];
            var val = $(".method_active").text();
            var str = $("#area").attr("areaid");

            var mul = 5;
            mul = $("#ch_n2 .num_show").text();
            var price = $(".choose_phar .u_p_active .p_active>div>div span").last().text();
            var p = price.substring(3, price.length) * mul; //产品费用
            var freight2 = $(".freight").text();
            var eatTime = $(".eat_time").text()
            // console.log(freight2.substring(1, freight2.length))
            var x = freight2.substring(1, freight2.length); //运费
            // var min_99 = $(".min_99").text();
            // var y = min_99.substring(1, min_99.length); //满99的优惠
            // var z = mul * 2; //代煎费
            // var c = mul * 2; //促销优惠
            // console.log(" 商品费用是：" + p, "运费是：" + x, "满减优惠是：" + y, "代煎费用是：" + z, "促销优惠是：" + c)

            if (val === "内服") {
                use_type = 0;
            } else if (val === "外用") {
                use_type = 1;
            }
            $(".num_lists .num_show ").each(function(i) {
                arry.push($(this).text());
            })
            $(".prohibit .fry_active").each(function(i) {
                arry2.push($(this).text());
            })
            useage = arry.join();
            taboo = arry2.join();
            advise = $(".other_tell textarea").val().replace(/(^\s*)|(\s*$)/g, "");;
            if(advise===""||advise==null){
                advise = "无";
            }
            // cityid = str.substring(6, 12);
            //"当前开方类型是:" + use_type +"服药时间"+eatTime+"贴数：" + useage+ "忌口与禁忌：" + taboo+ "更多医嘱：" + advise;
            test = use_type +"--"+eatTime+"--" + useage+ "--" + taboo+ "--" + advise;
            document.cookie="data_ok="+test+" ;Path="+escape("/");
            layer.msg('保存成功', {
                time: 1000
            });
            $(".backg3").css({
                "opacity": "0",
                "z-index": "-20000"
            })
            $(".spinner").hide();
            history.go(-1);
            // $.ajax({
            //     type: "post",
            //     url: "http://192.168.5.209/doctor_ajax.php?do=recipecity",
            //     data: {
            //         "city_id": 1302,
            //         "drug_type": 1,
            //         "type": 1
            //     },
            //     dataType: "json",
            //     success: function(data) {
            //         console.log(data)
            //     },
            //     error: function(err) {
            //         layer.msg('连接服务器失败', {
            //             time: 1000
            //         });
            //         $(".backg3").css({
            //             "opacity": "0",
            //             "z-index": "-20000"
            //         })
            //         $(".spinner").hide()
            //         history.go(-1)
            //     }
            // });
        }
        function closeWindows() {
            var browserName = navigator.appName;
            var browserVer = parseInt(navigator.appVersion);
            //alert(browserName + " : "+browserVer);

            //document.getElementById("flashContent").innerHTML = "<br>&nbsp;<font face='Arial' color='blue' size='2'><b> You have been logged out of the Game. Please Close Your Browser Window.</b></font>";

            if(browserName == "Microsoft Internet Explorer"){
                var ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? true : false;
                if (ie7)
                {
                    //This method is required to close a window without any prompt for IE7 & greater versions.
                    window.open('','_parent','');
                    window.close();
                }
                else
                {
                    //This method is required to close a window without any prompt for IE6
                    this.focus();
                    self.opener = this;
                    self.close();
                }
            }else{
                //For NON-IE Browsers except Firefox which doesnt support Auto Close
                try{
                    this.focus();
                    self.opener = this;
                    self.close();
                }
                catch(e){

                }

                try{
                    window.open('','_self','');
                    window.close();
                }
                catch(e){

                }
            }
        }
    </script>
    <script>
        $(".DefaultPharmacy").toggle(function() {
            $(".DefaultPharmacy>span").addClass("icon3_active");
            $(".in").removeClass("input_think_active");
        }, function() {
            $(".DefaultPharmacy>span").removeClass("icon3_active");
            $(".in").addClass("input_think_active")
        })
    </script>
</body>

</html>